<div id="Merging-more-than-once"></div>
<div class="header">
<p>
Next: [[cvs: Merging differences between any two revisions#Merging differences between any two revisions|Merging two revisions]], Previous: [[cvs: Merging an entire branch#Merging an entire branch|Merging a branch]], Up: [[cvs: Branching and merging#Branching and merging|Branching and merging]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="Merging-from-a-branch-several-times"></div>
=== Merging from a branch several times ===

Continuing our example, the revision tree now looks
like this:

<div class="example" style="margin-left: 3.2em">
 +-----+    +-----+    +-----+    +-----+    +-----+
 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   &lt;- The main trunk
 +-----+    +-----+    +-----+    +-----+    +-----+
                 !                           *
                 !                          *
                 !   +---------+    +---------+
 Branch R1fix -&gt; +---! 1.2.2.1 !----! 1.2.2.2 !
                     +---------+    +---------+
</div>

where the starred line represents the merge from the
&lsquo;<code>R1fix</code>&rsquo; branch to the main trunk, as just
discussed.

Now suppose that development continues on the
&lsquo;<code>R1fix</code>&rsquo; branch:

<div class="example" style="margin-left: 3.2em">
 +-----+    +-----+    +-----+    +-----+    +-----+
 ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !   &lt;- The main trunk
 +-----+    +-----+    +-----+    +-----+    +-----+
                 !                           *
                 !                          *
                 !   +---------+    +---------+    +---------+
 Branch R1fix -&gt; +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
                     +---------+    +---------+    +---------+
</div>

and then you want to merge those new changes onto the
main trunk.  If you just use the <code>cvs update -j
R1fix m.c</code> command again, <small>CVS</small> will attempt to
merge again the changes which you have already merged,
which can have undesirable side effects.

So instead you need to specify that you only want to
merge the changes on the branch which have not yet been
merged into the trunk.  To do that you specify two
&lsquo;<code>-j</code>&rsquo; options, and <small>CVS</small> merges the changes from
the first revision to the second revision.  For
example, in this case the simplest way would be

<div class="example" style="margin-left: 3.2em">
 cvs update -j 1.2.2.2 -j R1fix m.c    # <span class="roman" style="font-family:serif; font-weight:normal">Merge changes from 1.2.2.2 to the</span>
                                       # <span class="roman" style="font-family:serif; font-weight:normal">head of the R1fix branch</span>
</div>

The problem with this is that you need to specify the
1.2.2.2 revision manually.  A slightly better approach
might be to use the date the last merge was done:

<div class="example" style="margin-left: 3.2em">
 cvs update -j R1fix:yesterday -j R1fix m.c
</div>

Better yet, tag the R1fix branch after every merge into
the trunk, and then use that tag for subsequent merges:

<div class="example" style="margin-left: 3.2em">
 cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
</div>


----

<div class="header">
<p>
Next: [[cvs: Merging differences between any two revisions#Merging differences between any two revisions|Merging two revisions]], Previous: [[cvs: Merging an entire branch#Merging an entire branch|Merging a branch]], Up: [[cvs: Branching and merging#Branching and merging|Branching and merging]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
